package database;

import logger.LoggerManager;
import resurses.LoggerMessage;

/**
 * Created by alexander.makalov on 23.10.2014.
 */
public class UserData {

    public static Boolean getFileExist() {
        return fileExist;
    }

    public static void setFileExist(Boolean fileExist) {
        UserData.fileExist = fileExist;
    }

    public static String getUserName() {
        return userName;
    }

    public static void setUserName(String userName) {
        UserData.userName = userName;
    }

    public static String getUserPass() {
        return userPass;
    }

    public static void setUserPass(String userPass) {
        UserData.userPass = userPass;
    }

    public static String getDbUrl() {
        return dbUrl;
    }

    public static void setDbUrl(String dbUrl) {
        UserData.dbUrl = dbUrl;
    }

    public static boolean checkData(){
        if (userName == null || userPass==null || dbUrl == null){
            LoggerManager.getLogger().Log(LoggerMessage.URL_USERNAME_PASS_ERROR, LoggerManager.LogLevel.ERROR);
            return false;
        }
        LoggerManager.getLogger().Log(String.format(LoggerMessage.USER_INFO,UserData.getUserName(),UserData.getUserPass(),UserData.getDbUrl()), LoggerManager.LogLevel.INFO);
        return true;
    }
    private static String userName;
    private static String userPass;
    private static String dbUrl;
    private static Boolean fileExist;
}
